package myjava.i_collection;

import java.util.*;

/**
 * @Auther: cty
 * @Date: 2020/7/17 23:48
 * @Description:
 * @version: 1.0
 */
public class TestCollection {
    public static void main(String[] args) {
        // connection
        List<Integer> arrayList = new ArrayList<>();

        List<Integer> vector = new Vector<>();
//        vector.add(1);
//        vector.add(1);
//        System.out.println(vector.remove(vector.size()-1));
//        System.out.println(vector.remove(vector.size()-1));

        Stack<String> stack = new Stack<>();
//        stack.push(null);
//        String s = stack.pop();
//        String s2 = stack.peek();

        List<Integer> linkedList = new LinkedList<>();
//        linkedList.add(null);
//        System.out.println(linkedList.get(linkedList.size()-1));  // out: null  允许空值
//        linkedList.add(1);
//        linkedList.add(1);
//        System.out.println(linkedList.remove(linkedList.size()-1));  // out: 1
//        System.out.println(linkedList.remove(linkedList.size()-1));  // out: 1  允许重复值

        Queue<Integer> queue = new ArrayDeque<>();
//        queue.add(1);
//        queue.add(1);
//        System.out.println(queue.remove());
//        System.out.println(queue.remove());

//        System.out.println((0-1+16) % 16);
//        System.out.println((0-1) & 15);


        Queue<Integer> queue1 = new LinkedList<>();
//        Queue<String> queue = new ArrayDeque<>();
//        queue.add(null);
//        String q = queue.peek();

//        int numElements = 7;
//        int initialCapacity = 8;
//        if (numElements >= initialCapacity) {
//            initialCapacity = numElements;
//            initialCapacity |= (initialCapacity >>>  1);
//            initialCapacity |= (initialCapacity >>>  2);
//            initialCapacity |= (initialCapacity >>>  4);
//            initialCapacity |= (initialCapacity >>>  8);
//            initialCapacity |= (initialCapacity >>> 16);
//            initialCapacity++;
//            if (initialCapacity < 0)   // Too many elements, must back off
//                initialCapacity >>>= 1;// Good luck allocating 2 ^ 30 elements
//        }
//        System.out.println(initialCapacity);
//
//        Map<String, Integer> map = new HashMap<>();


        PriorityQueue<Integer> queue2 = new PriorityQueue<>();
//        queue2.add(5);
//        queue2.add(5);
//        System.out.println(queue2.remove());
//        System.out.println(queue2.remove());



    }  // end main
}  // end class


//interface Test{
//    void test();
//}
//
//class A implements Test{
//
//    @Override
//    public synchronized void test() {
//
//    }
//}
